Skip to content

Conversation

@Aashiq-J
Copy link
Member

@Aashiq-J Aashiq-J commented Nov 14, 2025

Description

Add script to install binaries which are required by the scripts in the module.

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@Aashiq-J Aashiq-J requested a review from vkuma17 as a code owner November 14, 2025 09:20
@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

2 similar comments
@Aashiq-J
Copy link
Member Author

/run pipeline

@Aashiq-J
Copy link
Member Author

/run pipeline

Copy link
Contributor

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much code duplication - lets sync up to see how we can handle here. Especially since this code would even be duplicated across multiple repos too. Perhaps time to leverage https://github.com/terraform-ibm-modules/common-bash-library

Copy link
Contributor

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have scripts/install-deps.sh and modules/kube-audit/scripts/install-deps.sh? We should only have 1 script that should be used by all the modules in this repo. If needed update the script to support only installing certain binaries if required

count = var.install_dependencies ? 1 : 0
# change trigger to run every time
triggers = {
build_number = timestamp()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this to trigger every time. It only need to trigger if the null resource has to run again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess thats not possible, if we set triggers to other null_resource blocks, the install script will run after there is a change in the other null_resource block and not before.

# Optional custom URL prefix for all binaries
CUSTOM_KUBECTL_URL="${CUSTOM_KUBECTL_URL:-}"
CUSTOM_JQ_URL="${CUSTOM_JQ_URL:-}"
CUSTOM_OC_URL="${CUSTOM_OC_URL:-}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not documented anywhere? We should probably list the environment variabl overrides in the variable descrption.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also rename them to:

  • CUSTOM_KUBECTL_URL -> KUBECTL_DOWNLOAD_URL
  • CUSTOM_JQ_URL -> JQ_DOWNLOAD_URL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just thinking that there might be authentication required for someones custom URL, but I guess its on them to make sure that handled.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the documentation to the main README

# Install: kubectl
#######################################

# renovate: datasource=github-releases depName=kubernetes/kubernetes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to add a custom renovate rule in renovate.json for this to work (copy the one in common-dev-asstes)

@Aashiq-J
Copy link
Member Author

@ocofaigh ,
kube-audit submodule can be used independently of the root module, thats why we have the install-binaries script in that submodule as well.

@Aashiq-J
Copy link
Member Author

/run pipeline

@ocofaigh
Copy link
Contributor

ocofaigh commented Nov 26, 2025

kube-audit submodule can be used independently of the root module, thats why we have the install-binaries script in that submodule as well.

@Aashiq-J Yea but you can still have it reference the scripts folder in the root directory


# Optional custom URL prefix for all binaries
KUBECTL_DOWNLOAD_URL="${KUBECTL_DOWNLOAD_URL:-}"
JQ_DOWNLOAD_URL="${JQ_DOWNLOAD_URL:-}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not default these to the public URLs if not specified and use it for the download later in the script. Then you won't need the if/else logic

BINARY=jq

if ! command -v jq >/dev/null 2>&1; then
echo "jq not found. Installing latest stable version locally..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "latest stable version" with the value of JQ_VERSION

Copy link
Contributor

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aashiq-J Lets hold off running the pipeline until we agree on the approach here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants